﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace ProjectSem3.Admin
{
    public partial class WebForm21 : System.Web.UI.Page
    {
        private dataDataContext dc = new dataDataContext();
        protected void Page_Load(object sender, EventArgs e)
        {

        }
        protected void ButtonSave_Click(object sender, EventArgs e)
        {
            Supplier sp = new Supplier();
            sp.Name = this.TextBoxSupplierName.Text;
            sp.Phone = this.TextBoxPhone.Text;
            sp.Address = this.TextBoxAddress.Text;
            sp.TypeOf = this.TextBoxTypeOf.Text;
            foreach (ListItem l in RadioButtonListStatus.Items)
            {
                if (l.Selected)
                {
                    if (l.Text.Equals("Check"))
                        sp.Status = true;
                    else
                        sp.Status = false;
                }
            }
            this.dc.Suppliers.InsertOnSubmit(sp);
            this.dc.SubmitChanges();
        }
    }
}